<div class="main f_r">
    <div class='tabs'>
        <div class="uc_title m_10 tabs_menu">
            <label class="current node" ><span>我的退款</span></label><label class="node" onclick="form_add()"><span>申请退款</span></label>
        </div>
        <div class="tabs_content">
            <div class='node' id="refunds_list" >
                <table class="list_table m_10" width="100%" cellpadding="0" cellspacing="0">
                    <col width="150px" />
                    <col width="150px" />
                    <col width="150px" />
                    <col width="150px" />
                    <col />
                    <thead><tr><th>退款方式</th><th>涉及订单</th><th>申请时间</th><th>处理状态</th><th>操作</th></tr></thead>
					<tbody>
					{set:$page= (isset($_GET['page'])&&(intval($_GET['page'])>0))?intval($_GET['page']):1;}
                    {query:name=refundment_doc where=user_id eq $user[user_id] order=id desc page=$page}
                        <tr>
                            <td>{if:$item['refundment_type']==0}退款至账户余额{elseif:$item['refundment_type']==1}退款至银行卡{else:}其它支付方式{/if}</td><td>{$item['order_no']}</td><td>{$item['time']}</td><td>{if:$item['pay_status']==0}<span class="orange bold">等待处理</span>{elseif:$item['pay_status']==1}<span class="gray bold">退款失败</span>{elseif:$item['pay_status']==2}<span class="green bold">退款成功</span>{/if}</td><td>{if:$item['pay_status']==0}<a class="blue" href="javascript:void(0)" onclick='delModel({link:"{url:/ucenter/refunds_del/id/$item[id]}"})'>取消</a>|<a class="blue" href="javascript:void(0)" onclick='form_back({echo:JSON::encode($item)})'>修改</a>|{/if}<a class="blue" href="{url:/ucenter/refund_detail/id/$item[id]}">查看</a></td>
                        </tr>
                    {/query}
                    </tbody>
					<tfoot><tr><td colspan="5" class="t_l">{$query->getPageBar()}</td></tr></tfoot>
                </table>
            </div>
        </div>
    </div>
    <div id="refunds_form" class="orange_box">
	    <form action="{url:/ucenter/refunds_edit}" method='post' name='refunds'>
		    <input type="hidden" name="id" value="" />
		    <table  class=" form_table" width="100%" cellpadding="0" cellspacing="0">
		        <col width="120px" />
		        <col />
		        <caption>退款信息：</caption>
		        <tr>
		            <th>涉及订单号：</th><td><input type="text" name="order_no" pattern='^\d{20}$' alt='订单号不正确' class="normal" value="{echo:IReq::get('order_no')}" /><label>请填写上你购买的订单账号</label></td>
		        </tr>
		        <tr>
		            <th>退款类型：</th>
		            <td class="gray">
		                <label class='attr'><input class="radio" type="radio" name="refundment_type" value="0" onclick='setRefundment(0)' id="RadioGroup1_0" checked="checked" />退款至账户余额（<span class="orange">推荐</span>，不会收取手续费，今后可随时将账户余额退至银行卡）</label><br />
		                <label class='attr'><input class="radio" type="radio" name="refundment_type" value="1" onclick='setRefundment(1)' id="RadioGroup1_0" />退款至银行卡（跨行退款需要扣除一定积分用以支付银行手续费）</label><br />
		                <label class='attr'><input class="radio" type="radio" name="refundment_type" value="2" onclick='setRefundment(2)' id="RadioGroup1_0" />其它方式:（如支付宝、快钱等等）</label>
		            </td>
		        </tr>
		        <tr id="refundment_name">
		            <th>开户行/支付方式：</th><td><input type="text" pattern="required" name="refundment_name" class="normal" /></td>
		        </tr>
		        <tr id="refundment_username">
		            <th>开户名：</th><td><input type="text" pattern="required" name="refundment_username" class="normal" /></td>
		        </tr>
		        <tr id="refundment_account">
		            <th>账号：</th><td><input type="text" pattern="required" name="refundment_account" class="normal" /></td>
		        </tr>
		        <tr>
		            <th>申请原因：</th><td><textarea name="content"></textarea></td>
		        </tr>
		        <tr>
		            <th></th><td colspan="3"><label class="btn"><input type="submit" value="提交退款申请" /></label><label class="btn"><input type="reset" value="取消" onclick="javascript:window.location.href='{url:/ucenter/refunds}'" /></label></td>
		        </tr>
		    </table>
	    </form>
    </div>
</div>
<script type='text/javascript'>

	//初始化表单
	$('#refundment_name ,#refundment_name input').css('display','none');
	$('#refundment_username, #refundment_username input').css('display','none');
	$('#refundment_account, #refundment_account input').css('display','none');
	function setRefundment(type)
	{
	    if(type==0)
	    {
	        $('#refundment_name ,#refundment_name input').css('display','none');
	        $('#refundment_username, #refundment_username input').css('display','none');
	        $('#refundment_account, #refundment_account input').css('display','none');
	    }
	    else if(type==1)
	    {
	        $('#refundment_name ,#refundment_name input').css('display','');
	        $('#refundment_username, #refundment_username input').css('display','');
	        $('#refundment_account, #refundment_account input').css('display','');
	    }
	    else if(type==2)
	    {
	        $('#refundment_name ,#refundment_name input').css('display','');
	        $('#refundment_username, #refundment_username input').css('display','none');
	        $('#refundment_account, #refundment_account input').css('display','');
	    }
	}
	function form_back(obj)
	{
	    $('#refunds_list').css('display','none');
	    var form = new Form('refunds');
	    form.init(obj);
	    setRefundment(obj.refundment_type);
	}
	function form_add()
	{
	    var form = new Form();
	    form.init({"order_no":"","amount":null,"time":"","refundment_type":"0","refundment_username":"","refundment_name":"","refundment_account":"","refundment_bank":"0","content":""});
	    setRefundment(0);
	}
	{if:isset($this->msg) && $this->msg!=''}alert('{$this->msg}');var form = new Form();var obj = {$this->info};form.init(obj);setRefundment(obj.refundment_type);{/if}
</script>
